package org.feiye.studyday26;

public class RunnableCreat implements Runnable {
	// Thread.currentThread().getName():当前线程名
	@Override
	public void run() {
		for (int i = 0; i <= 100; i++) {
			System.out.println(Thread.currentThread().getName() + "," + i);
		}
	}

	public static void main(String[] args) {
		// new了5个实现Runnable接口的对象
//		for (int i = 0; i < 5; i++) {
//			RunnableCreat r = new RunnableCreat();
//			Thread t = new Thread(r, "newThread" + i);
//			t.start();
//		}
		// new了1个实现Runnable接口的对象
		RunnableCreat r = new RunnableCreat();
		for (int i = 0; i < 5; i++) {
			Thread t = new Thread(r, "newThread" + i);
			t.start();
		}
	}

}
